package com.webdesign.action;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.webdesign.service.ITbHomeworkService;

@Controller("ModifyHomeworkAction")
@Scope("prototype")
public class ModifyHomeworkAction extends ActionSupport {
	private ITbHomeworkService iTbHomeworkService;

	private String homeworkid;

	private String title;

	private String description;

	private String starttime;

	private String endtime;

	private String graded;

	//修改作业信息
	public String modifyHomework() {

		iTbHomeworkService.modifyHomework(homeworkid, title, description,
				starttime, endtime, graded);
		Map<String,Object> session = ActionContext.getContext().getSession();
		String terminfo =  (String)session.get("termid");
		ActionContext.getContext().put("url", "/teacher/selectTerm?terminfo="+terminfo);
		return "redirect";
	}

	public ITbHomeworkService getiTbHomeworkService() {
		return iTbHomeworkService;
	}

	@Resource(name = "TbHomeworkService")
	public void setiTbHomeworkService(ITbHomeworkService iTbHomeworkService) {
		this.iTbHomeworkService = iTbHomeworkService;
	}

	public String getHomeworkid() {
		return homeworkid;
	}

	public void setHomeworkid(String homeworkid) {
		this.homeworkid = homeworkid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getStarttime() {
		return starttime;
	}

	public void setStarttime(String starttime) {
		this.starttime = starttime;
	}

	public String getEndtime() {
		return endtime;
	}

	public void setEndtime(String endtime) {
		this.endtime = endtime;
	}

	public String getGraded() {
		return graded;
	}

	public void setGraded(String graded) {
		this.graded = graded;
	}

}
